UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WOSIPCekug1Z7VE2JtktjhHVbPBTu9HN8BdZmp41Gj0=' 
WHERE 
  key_id = '5dc0cf029b81018df15c4e22375e2ee6d61547ebf1cd96063154ce6f09e5a147' 
  AND (
    token = 'WOSIPCekug1Z7VE2JtktjhHVbPBTu9HN8BdZmp41Gj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056