UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CsNJgR5Dvkrdcv8P2jCsQH7q0LtlZeh//9s/dGMY44U=' 
WHERE 
  key_id = '6346f7c6772ea75b7ecfb9355e5f17d7ac45ffc719d34ebd13f8c395e468eba5' 
  AND (
    token = 'CsNJgR5Dvkrdcv8P2jCsQH7q0LtlZeh//9s/dGMY44U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034