UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qWjumE/ndB3CDAgza49amoza5tyPDLY+9T3HPdrxIzU=' 
WHERE 
  key_id = 'f8eda6c9a3e6953945668eac3e4d775d22deb0768ba411bc28a8b0f65baea469' 
  AND (
    token = 'qWjumE/ndB3CDAgza49amoza5tyPDLY+9T3HPdrxIzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037