UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E58e9c9KgdKZOyx9AnFZcKfRFoINnEuqWUEKr0AiQN8=' 
WHERE 
  key_id = '5743ed9da98100b4a3248ade927ef63d36791f4422612fffccd6a83eeba870ff' 
  AND (
    token = 'E58e9c9KgdKZOyx9AnFZcKfRFoINnEuqWUEKr0AiQN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00083