UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sU8tqMEgTfXDlAZAYPZd3WVyTwQMWOOZ9nsR7GgJa1Y=' 
WHERE 
  key_id = '80652fc1f8e358e5e80f6c7728c0e0d398ca73d32276c7bd01420c9fa89da787' 
  AND (
    token = 'sU8tqMEgTfXDlAZAYPZd3WVyTwQMWOOZ9nsR7GgJa1Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026