UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3ggeNBTvGsKXhVgx+jTmcaeftsKr7+kCCdWzubGXcmo=' 
WHERE 
  key_id = 'ec5fdfa71e7f157cee98dc8b4f7b213f42d9dd952ac040fa212105cad05aa529' 
  AND (
    token = '3ggeNBTvGsKXhVgx+jTmcaeftsKr7+kCCdWzubGXcmo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055