UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'THRFPnVulKRLCrv5vkmhZU0esymGXQ77btGFBfc4KEE=' 
WHERE 
  key_id = '892a3f89b1555df044c1b0678178db56fa86e960430424cd4a05d4bceff6504c' 
  AND (
    token = 'THRFPnVulKRLCrv5vkmhZU0esymGXQ77btGFBfc4KEE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037