UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8y8+uK34ZeuIq/pqfQdYCXCVX38PhmjEeh/lcyIXF44=' 
WHERE 
  key_id = '1fafc7d636152de80a4cfe2be62acf21b73c157df8f92f80959f28fadad2b95e' 
  AND (
    token = '8y8+uK34ZeuIq/pqfQdYCXCVX38PhmjEeh/lcyIXF44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062