UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KxBnNUPAprjzmPBFstaa7pEDVm4KqQdRPQffrQ0Ey3k=' 
WHERE 
  key_id = '168e178ae34bae5d638a2081722cd078e58490ea203154ef11c1c5af87e45e93' 
  AND (
    token = 'KxBnNUPAprjzmPBFstaa7pEDVm4KqQdRPQffrQ0Ey3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026