UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AizqDFn6P8hf69knjFpYsJ746Uh+TjOXT1EQrTb4lLA=' 
WHERE 
  key_id = 'fac472116495d276622f4cfd374547737bc4cd3cb5a132e4311a9da81aa3cca4' 
  AND (
    token = 'AizqDFn6P8hf69knjFpYsJ746Uh+TjOXT1EQrTb4lLA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016