UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'srBGw3qAgBp08nwTfK2BcpcxanGDh1+V+fxFOuWPjNQ=' 
WHERE 
  key_id = '04941eb22b730dd5572b31aa6629007dd0772969e8c42ed4843a275947163943' 
  AND (
    token = 'srBGw3qAgBp08nwTfK2BcpcxanGDh1+V+fxFOuWPjNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063