UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DidguPap1EBeNIvs219JUPMuxD6Yz2gVFJCBY6tGaas=' 
WHERE 
  key_id = '3a9c4a17dba2c2f16af8279bf9aa72ae06b929ec38d7a4bdaa5d45801ae98cf4' 
  AND (
    token = 'DidguPap1EBeNIvs219JUPMuxD6Yz2gVFJCBY6tGaas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016