UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7t1tT66ARyATwHsEkr14d6kw/trCZeg5yf4QpzquVhg=' 
WHERE 
  key_id = '00876a4ddb05fa111cd8ca7ddd680acf14fc9f6e5d0f61d95e793749a6f9b305' 
  AND (
    token = '7t1tT66ARyATwHsEkr14d6kw/trCZeg5yf4QpzquVhg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021