UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4lj2m0qCEK/bbHIhJQ3x834i8JbWmTPZmRsT1SQm4yk=' 
WHERE 
  key_id = '5b62de0e4056d602469b377f30836ed2909f37f7186079e573b0dd413a1ada86' 
  AND (
    token = '4lj2m0qCEK/bbHIhJQ3x834i8JbWmTPZmRsT1SQm4yk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034