UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oB59BE9Yy4+VnzBhyeJHXyTsWD4c8Kbz7uQPZU0un08=' 
WHERE 
  key_id = '641567ce87fb90f60f47cd9ff493fb4fc167fdba86856a30149fd40b2b86074c' 
  AND (
    token = 'oB59BE9Yy4+VnzBhyeJHXyTsWD4c8Kbz7uQPZU0un08=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039