UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QTsLc38MD/O+E78jlOz/ghbspgbJzX8RbeJJQ2pfJtY=' 
WHERE 
  key_id = '9097d50380fe4dc37d4bd240310181ec79e3bbf3bed7bf6340eba93a90e32b31' 
  AND (
    token = 'QTsLc38MD/O+E78jlOz/ghbspgbJzX8RbeJJQ2pfJtY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035