UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v7FNbqXTdz79ofO5Vp+WeAqjmvfd86P4g7iFq6Yvsv8=' 
WHERE 
  key_id = '6e71b9611792dd61d03bb862049cac6e604bfb8974ab84e04a3187fc64859656' 
  AND (
    token = 'v7FNbqXTdz79ofO5Vp+WeAqjmvfd86P4g7iFq6Yvsv8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036