UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qAmPM3o+lfAJE969kG+1XsLCRVlOY5l+vRJgWlwCkK0=' 
WHERE 
  key_id = 'a8fd926fabe4687effbde71e4a00479cff48f4374921410935067b8e111435c8' 
  AND (
    token = 'qAmPM3o+lfAJE969kG+1XsLCRVlOY5l+vRJgWlwCkK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040