UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eYtgPP07o1U0lpt0hGeivf61PA80DijlPjSCJRUcssk=' 
WHERE 
  key_id = '8ca4c23a61af3b25eabde6ed8657318e98073c71b6447194b2b8a09152d40635' 
  AND (
    token = 'eYtgPP07o1U0lpt0hGeivf61PA80DijlPjSCJRUcssk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043