UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TxnN4Pfdw9yybWaXyg5w5K9R0t+r+7naJKqiD8NziEc=' 
WHERE 
  key_id = '3a470fb760989089da5515f064724d8f2a05be8be4cccd6529dceacacf4952da' 
  AND (
    token = 'TxnN4Pfdw9yybWaXyg5w5K9R0t+r+7naJKqiD8NziEc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032