UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GqqGHueNyJfPvnMn6wNbjfPe7/omgzEvf3NmyINbfyA=' 
WHERE 
  key_id = '494737ba44a1dc2d50776966204b442f74237067902ddbca123a7c6cb6dc13c9' 
  AND (
    token = 'GqqGHueNyJfPvnMn6wNbjfPe7/omgzEvf3NmyINbfyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022