UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mEnSVwUvRMWfHDHKSq+NDcz7oXgvCYrzCY4hX1nAo18=' 
WHERE 
  key_id = 'f270fdf5f4f320f07ca313c4257ac63655c28be353827a865e8ac10bdea0a377' 
  AND (
    token = 'mEnSVwUvRMWfHDHKSq+NDcz7oXgvCYrzCY4hX1nAo18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032