UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D2IO0+o9QbHTPg1h2QTToVaKeZLgPVio0buiinzksOc=' 
WHERE 
  key_id = '654a9f106d782333e64c0a9304170e9ecf5a91266524a0d4c416d5e663bc7c2f' 
  AND (
    token = 'D2IO0+o9QbHTPg1h2QTToVaKeZLgPVio0buiinzksOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043