UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yXvVQWiy1WhZaRcs/9QhE3Y33giBOY3k5rdLtksEwRA=' 
WHERE 
  key_id = 'd4044d0ffc33abe18d8b869d7293a349c70d30b0e5e9f1756dbcc4e2cae13980' 
  AND (
    token = 'yXvVQWiy1WhZaRcs/9QhE3Y33giBOY3k5rdLtksEwRA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040