UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QW6LgrMw22qaBO5PUgmyIAwSIBZxPDsqG1a25nmKvxc=' 
WHERE 
  key_id = '97806fc077e9c495c1d7b86103ca817f8d5163a2ce238f959911bf4a31065585' 
  AND (
    token = 'QW6LgrMw22qaBO5PUgmyIAwSIBZxPDsqG1a25nmKvxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037