UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+ryO49dvbVyNenYlJAOoGYgpIBYxStBRPfl+301tVF8=' 
WHERE 
  key_id = '52d9abbfb941fa2054f96ebe541a9db91c7f06d55040b717e724138dfc84a491' 
  AND (
    token = '+ryO49dvbVyNenYlJAOoGYgpIBYxStBRPfl+301tVF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027