UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BIOJHgLwr97+6HZGQLUB/LQPR1LGFQOefesGx161s+s=' 
WHERE 
  key_id = '2c7e9524c739c3e7044e6ececa71ade3d03a9235fcc5d7566f36f931a883d281' 
  AND (
    token = 'BIOJHgLwr97+6HZGQLUB/LQPR1LGFQOefesGx161s+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029