UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wnhg5ZjHfHBjDZ9c+v9grl1X3YbxxfIgnGWY+syfkw8=' 
WHERE 
  key_id = '7b1097a67dc3e2b034215b71bdc8acbad51cc43453d9aedf99a5360d1da871c9' 
  AND (
    token = 'wnhg5ZjHfHBjDZ9c+v9grl1X3YbxxfIgnGWY+syfkw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020