UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h6iMgLXnDalRdI4vHpaS2bmBoXrI0Q7zn8Y+afF+0UM=' 
WHERE 
  key_id = '6a23d9406fff1c9c040c96bea2787f29c3deaa9bc35f7341e77ceb9b1dbb37ef' 
  AND (
    token = 'h6iMgLXnDalRdI4vHpaS2bmBoXrI0Q7zn8Y+afF+0UM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063