UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H6Kp4y2P1ck1JVXExggdUpum/bAY3Dkg+u+0uGIXdSU=' 
WHERE 
  key_id = 'f28f849f958a6d6f4915e06bffc63518613fc4555640cf8ee1f556ca86b90ab4' 
  AND (
    token = 'H6Kp4y2P1ck1JVXExggdUpum/bAY3Dkg+u+0uGIXdSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026