UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ASC5USVOQGa0z3Vjx2UrGknFftVNtzA758GMMZkKWA8=' 
WHERE 
  key_id = '0b4eefb5c36e59c056cc1c1b44d7e5e05746e22c737f18f09e2219bd36456527' 
  AND (
    token = 'ASC5USVOQGa0z3Vjx2UrGknFftVNtzA758GMMZkKWA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016