UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2mZuhxzO+1uraO2TrmbocOJZCITJudJ7fm76gN+ls6U=' 
WHERE 
  key_id = '01555e6fba42dee2b10a185246b4ce289874466205b55d6f956cbe0927fb6406' 
  AND (
    token = '2mZuhxzO+1uraO2TrmbocOJZCITJudJ7fm76gN+ls6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026