UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pdQjdGp9kXulvfpGHHQak+hJt5Ms+KilpniVv7nCSSs=' 
WHERE 
  key_id = '2f6d18980c32a7fca5a5fc0bab8f7907e0171253a441b6005b7a8e0673b8655b' 
  AND (
    token = 'pdQjdGp9kXulvfpGHHQak+hJt5Ms+KilpniVv7nCSSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038