UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0kpBouB4d3ZgFtyvXiLcTGG/LRM42YSRig1nILVFnhs=' 
WHERE 
  key_id = '107457cab1bf87ab04f12dc60711bf5c024dda850dd58e728e37ab34c36b3d5d' 
  AND (
    token = '0kpBouB4d3ZgFtyvXiLcTGG/LRM42YSRig1nILVFnhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037