UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YYTloxUdGIYpMZOa3qfQgblDdB0Zt3LgNP0QkKHeWos=' 
WHERE 
  key_id = 'c4cf75e3a7461dc76eafaf8f73bee1b4980e5f8320a94df40ce360acc5e626e4' 
  AND (
    token = 'YYTloxUdGIYpMZOa3qfQgblDdB0Zt3LgNP0QkKHeWos=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026